//element数据转换
//级联数据转换
function cascaderList(list) {
	let elementList = JSON.parse(JSON.stringify(list).replace(/id/g, "value"))
	elementList = JSON.parse(JSON.stringify(elementList).replace(/next/g, "children"))
	elementList = JSON.parse(JSON.stringify(elementList).replace(/name/g, "label"))
	//如果没有子集数据，就将那级数据去除
	/*deleteChildren(elementList)*/
	return elementList
}
//虚拟设备树数据转换
function deviceList(list) {
	//debugger
	let elementList = JSON.parse(JSON.stringify(list).replace(/next/g, "children"))
	elementList = JSON.parse(JSON.stringify(elementList).replace(/name/g, "label"))
	return elementList
}
//能流树数据转换
function energyFlowList(list) {
	let elementList = JSON.parse(JSON.stringify(list).replace(/next/g, "children"))
	elementList = JSON.parse(JSON.stringify(elementList).replace(/deviceName/g, "label"))
	return elementList
}
//svg树数据转换
function svgList(list) {
	let elementList = JSON.parse(JSON.stringify(list).replace(/path/g, "id"))
	elementList = JSON.parse(JSON.stringify(elementList).replace(/next/g, "children"))
	elementList = JSON.parse(JSON.stringify(elementList).replace(/name/g, "label"))
	return elementList
}
//下载文件树数据转换
function downloadList(list) {
	let elementList = JSON.parse(JSON.stringify(list).replace(/next/g, "children"))
	return elementList
}
//单位树数据转换
function unitList(list) {
	let elementList = JSON.parse(JSON.stringify(list).replace(/next/g, "children"))
	elementList = JSON.parse(JSON.stringify(elementList).replace(/name/g, "label"))
	return elementList
}
//台账树数据转换级联
function archivesList(list) {
	let elementList = JSON.parse(JSON.stringify(list).replace(/next/g, "children"))
	elementList = JSON.parse(JSON.stringify(elementList).replace(/typeName/g, "label"))
	elementList = JSON.parse(JSON.stringify(elementList).replace(/property/g, "value"))
	//如果没有子集数据，就将那级数据去除
	deleteChildren(elementList)
	return elementList
}
//虚拟设备转换成级联数据
function deviceListCascade(list) {
	let elementList = JSON.parse(JSON.stringify(list).replace(/next/g, "children"))
	elementList = JSON.parse(JSON.stringify(elementList).replace(/name/g, "label"))
	elementList = JSON.parse(JSON.stringify(elementList).replace(/no/g, "value"))
	//如果没有子集数据，就将那级数据去除
	deleteChildren(elementList)
	return elementList
}
//删除没有数据的子集
function deleteChildren(list) {
	list.forEach(function(item){
		if(!isempty(item.children)) {
			deleteChildren(item.children)
		} else {
			delete item.children;
		}
	})
}

//返还选中的那一项数据
function selectedData(list,list2){
	let selectData=list
	list2.forEach(function(item){
		selectData.forEach(function(item2){
			if(item==item2.value){
				if(isempty(item2.children)){
					selectData=item2
				}else{
					selectData=item2.children
				}
			}
		})
	})
	return selectData
}
//递归获取第一个设备

